import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
	mode: 'history',
	// base: process.env.BASE_URL,
	base: '/netdisk',
	routes: [
		{
			path: '/',
			name: 'Home',
			component: () => import('_v/Home.vue'),
			meta: {
				title: '在线网盘 | 在线预览编辑 | 分片、断点续传 | 文件分享',
				content: {
					description: '基于 Spring Boot + Vue 框架开发的在线网盘系统'
				}
			}
		},
		{
			path: '/login',
			name: 'Login',
			component: () => import('_v/Login.vue'),
			meta: { title: '登录' }
		},
		{
			path: '/register',
			name: 'Register',
			component: () => import('_v/Register.vue'),
			meta: { title: '注册' }
		},
		{
			path: '/profile',
			name: 'Profile',
			component: () => import('_v/Profile.vue'),
			meta: { title: '个人信息' }
		},
		{
			path: '/file',
			name: 'File',
			component: () => import('_v/File.vue'),
			meta: {
				title: '网盘',
				content: {
					description: '图片 文档 视频 音乐 其他 回收站 我的分享'
				}
			}
		},
		{
			path: '/share/:shareBatchNum',
			name: 'MyShare',
			component: () => import('_v/Share.vue'),
			meta: {
				title: '分享',
				content: {
					description: '查看他人分享'
				}
			},
			props: true
		},
		{
			path: '/notice',
			name: 'MyNotice',
			component: () => import('_v/notice/NoticeList.vue'),
			meta: {
				title: '公告',
				content: {
					description: '公告列表'
				}
			}
		},
		{
			path: '/notice/:noticeId',
			name: 'NoticeDetail',
			component: () => import('_v/notice/NoticeDetail.vue'),
			meta: {
				title: '公告详情',
				content: {
					description: '公告详情'
				}
			}
		},
		{
			path: '*',
			name: 'Error_404',
			component: () => import('_v/404.vue'),
			meta: { title: '链接不存在' }
		}
	]
})

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
	return originalPush.call(this, location).catch((err) => err)
}
